package com.nbufe.controller;

import com.nbufe.domain.ResponseResult;
import com.nbufe.domain.dto.ModifyElectricHeatInfoDto;
import com.nbufe.domain.entity.FixCarbon;
import com.nbufe.domain.entity.Material;
import com.nbufe.domain.form.AddFixCarbonInfoForm;
import com.nbufe.domain.form.ModifyFixCarbonForm;
import com.nbufe.domain.form.QueryFixCarbonForm;
import com.nbufe.domain.vo.ElectricHeatBuyInfoVo;
import com.nbufe.service.FixCarbonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author LZH
 * @date 2023/4/4
 */
@CrossOrigin
@Api(tags = "固碳产品模块接口")
@RestController
@RequestMapping("/fixCarbon")
public class FixCarbonController {

    @Resource
    private FixCarbonService fixCarbonService;

    @ApiOperation("分页条件查询固碳产品信息")
    @PostMapping("/pageList")
    public ResponseResult pageList(@RequestBody QueryFixCarbonForm form) {
        return fixCarbonService.pageList(form);
    }

    @ApiOperation("获取所有存在的年份")
    @GetMapping("/years")
    public ResponseResult listYears() {
        List<Integer> years = fixCarbonService.listYears();
        return ResponseResult.okResult(years);
    }

    @ApiOperation("获取所有固碳产品")
    @GetMapping("/listFixCarbon")
    public ResponseResult listFixCarbon() {
        List<Material> fixCarbonList = fixCarbonService.listAllFixCarbon();
        return ResponseResult.okResult(fixCarbonList);
    }

    @ApiOperation("修改固碳产品信息")
    @PutMapping("/modify")
    public ResponseResult modifyFossiFuelInfo(@RequestBody ModifyFixCarbonForm form) {
        return fixCarbonService.modifyFixCarbonInfo(form);
    }

    @ApiOperation("批量/单个删除固碳产品信息")
    @DeleteMapping("/delete")
    public ResponseResult deleteFossiFuel(@RequestBody List<Integer> ids) {
        return fixCarbonService.deleteOneOrBatch(ids);
    }

    @ApiOperation("添加固碳产品产量信息")
    @PostMapping("/add")
    public ResponseResult addElectricHeat(@RequestBody AddFixCarbonInfoForm form) {
        return fixCarbonService.addFixCarbonInfo(form);
    }
}
